package com.gitee.liuzhi.demo.juc.threadpoolexecutor.conf;

import com.gitee.liuzhi.demo.juc.threadpoolexecutor.factory.MyThreadFactory;

import java.util.concurrent.*;

/**
 * 线程池配置类
 *
 * @Author liuzhi
 * @Date 2023/9/6 20:39
 * @Version 1.0
 * @Description
 */
public class ThreadPoolConfiguration {

    /**
     * 核心线程池大小
     */
    public static final Integer corePoolSize = 20;
    /**
     * 最大线程池大小
     */
    public static final Integer maximumPoolSize = 20;
    /**
     * 线程最大空闲时间
     */
    public static final Long keepAliveTime = 10L;
    /**
     * 时间单位
     */
    public static final TimeUnit timeUnit = TimeUnit.SECONDS;
    /**
     * 线程等待队列
     */
    public static final BlockingQueue workQueue = new LinkedBlockingQueue<>(2000);
    /**
     * 线程创建工厂
     */
    public static final ThreadFactory threadFactory = new MyThreadFactory();
    /**
     * 拒绝策略
     */
    public static final RejectedExecutionHandler rejectedExecutionHandler = new ThreadPoolExecutor.CallerRunsPolicy();

}
